package com.dlnu.shoping.shopping.controller;

import com.dlnu.shoping.shopping.common.Result;
import com.dlnu.shoping.shopping.service.IAddressService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/address")
public class addressController {
    @Resource
    private IAddressService addressService;
//    有参数查询用户地址
    @RequestMapping("/search")
    public Result search(@RequestParam int useId) {
        return addressService.search(useId);
    }

//    无参数查询用户地址
    @RequestMapping("/queryList")
    public Result queryList() {
        return addressService.queryList();
    }

//    添加地址
    @RequestMapping("/add")
    public Result add(Integer useId, String address, String phone) {
        return addressService.add(useId,address,phone);
    }

//    修改地址
    @RequestMapping("/update")
    public Result update(Integer addressId, String address, String phone) {
        return addressService.update(addressId,address,phone);
    }

//    删除地址
    @RequestMapping("/delete")
    public Result delete(Integer addressId) {
        return addressService.delete(addressId);
    }
}
